//
//  SelectTimeView.m
//  HaiGoumerMerchant
//
//  Created by apple on 17/1/22.
//  Copyright © 2017年 com.zaoguankeji.www. All rights reserved.
//

#import "SelectTimeView.h"

@implementation SelectTimeView

-  (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.userInteractionEnabled =YES;
         self = [self configureView];
        [self.segmentStyleView addSubview:self.segment1];
        [self.selTimeView addSubview:self.menu];
    }
    return  self;

}

- (SelectTimeView *)configureView {
    
    NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"SelectTimeView" owner:nil options:nil];
  
    return  [nibContents lastObject];
    
}
- (JPullDownMenu *)menu {
    if (!_menu) {
        self.menu = [[JPullDownMenu alloc]initWithFrame:CGRectMake(0, self.y,80, 44) menuTitleArray:@[@"所有"]];
          NSArray * regionArray =@[@"所有", @"今日", @"昨日", @"近一周", @"近一月"];
        self.menu.menuDataArray = [NSMutableArray arrayWithObjects:regionArray, nil];
    }
    
    return _menu;
}
- (YUSegment *)segment1 {
    if (!_segment1) {
        
    NSArray *titles1 = @[@"全部",@"待付款",@"待发货",@"已成功",@"已关闭"];
    
    self.segment1 = [[YUSegment alloc] initWithTitles:titles1];
      self.segment1.frame = CGRectMake(80, self.y, self.segmentStyleView.frame.size.width, self.segmentStyleView.frame.size.height);
        __weak typeof(self) _self = self;
        [self.menu setHandleSelectDataBlock:^(NSString *selectTitle, NSUInteger selectIndex, NSUInteger selectButtonTag) {
            
//            _self.titleLabel.text = [NSString stringWithFormat:@"selectTitle = %@\n selectIndex = @%lu\n selectButtonTag = @%lu",selectTitle,selectIndex,selectButtonTag];
        }];
    }
    return _segment1;
}

- (void)layoutSubviews {
    self.frame = CGRectMake(0, 0, self.frame.size.width, 44);
     self.segment1.frame = self.segmentStyleView.bounds;
    [super layoutSubviews];
}



@end
